<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>伸缩容器_水平垂直居中</title>
  <style>
    body{
      display: flex;
    }
    .outer{
      width: 500px;
      height: 500px;
      background-color: gray;
      display: flex;
    /*  方式一*/
    /*  justify-content: center;*/
    /*  align-items: center;*/
    }
    .inner{
      width: 100px;
      height: 100px;
      border: 1px solid black;
      box-sizing: border-box;
      background-color: skyblue;
      /*方案二*/
      margin: 0 auto;
    }
  </style>
</head>
<body>
<div class="outer">
  <div class="inner"></div>

</div>
</body>
</html>